
import React, { Component } from 'react'
import pubSub from "../../../utils/myPubSub";

export default class SonB extends Component {

  componentDidMount(){
    console.log("componentDidMount");
    // if(如果没有订阅了主题：onclick){
    if(!pubSub._pubsub_topics.onclick){
      pubSub.subscribe("onclick",(str)=>{
        console.log("str",str);
      });
    }   

    console.log("pubSub",pubSub);
    
    // console.log("pubSub._pubsub_topics",pubSub._pubsub_topics);

  }

  render() {
    return (
      <>
        <div>SonB</div>
      </>
    )
  }
}
